home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / pgp23src.zip / SRC / SPARC.S < prev    next >
Text File  |  1993-05-09  |  2KB  |  84 lines

  1. !
  2. ! SPARC assembler primitives for rsalib.c
  3. ! written by Branko Lankester, lankeste@fwi.uva.nl    8/29/91
  4. !
  5. ! Tested with gcc 1.39 and newer, and SunOS cc.
  6. ! NOTE: does not work with gcc 1.37 (and older?)
  7. !
  8. ! other sources must be compiled with UNIT32 and HIGHFIRST defined
  9. !
  10.     .seg    "text"
  11.         .proc   4
  12.         .global _P_SETP
  13. _P_SETP:
  14.     retl
  15.     nop
  16.  
  17.  
  18.         .proc   4
  19.         .global _P_ADDC
  20. _P_ADDC:
  21.     sethi    %hi(_global_precision), %o3
  22.     ldsh    [%o3+%lo(_global_precision)], %o3
  23.     and    %o2, 1, %o2
  24.     dec    %o3
  25.     sll    %o3, 2, %o3
  26.     ld    [%o0+%o3], %o4
  27. add_loop:
  28.     ld    [%o1+%o3], %o5
  29.     subcc    %g0, %o2, %g0
  30.     addxcc    %o4, %o5, %o4
  31.     addx    %g0, %g0, %o2
  32.     st    %o4, [%o0+%o3]
  33.     subcc    %o3, 4, %o3
  34.     bge,a    add_loop
  35.     ld    [%o0+%o3], %o4
  36.     retl
  37.     mov    %o2, %o0        ! return carry
  38.  
  39.  
  40.         .proc   4
  41.         .global _P_SUBB
  42. _P_SUBB:
  43.     sethi    %hi(_global_precision), %o3
  44.     ldsh    [%o3+%lo(_global_precision)], %o3
  45.     and    %o2, 1, %o2
  46.     dec    %o3
  47.     sll    %o3, 2, %o3
  48.     ld    [%o0+%o3], %o4
  49. sub_loop:
  50.     ld    [%o1+%o3], %o5
  51.     subcc    %g0, %o2, %g0
  52.     subxcc    %o4, %o5, %o4
  53.     addx    %g0, %g0, %o2
  54.     st    %o4, [%o0+%o3]
  55.     subcc    %o3, 4, %o3
  56.     bge,a    sub_loop
  57.     ld    [%o0+%o3], %o4
  58.     retl
  59.     mov    %o2, %o0
  60.  
  61.  
  62.         .proc   4
  63.         .global _P_ROTL
  64. _P_ROTL:
  65.     sethi    %hi(_global_precision), %o3
  66.     ldsh    [%o3+%lo(_global_precision)], %o3
  67.     and    %o1, 1, %o1
  68.     dec    %o3
  69.     sll    %o3, 2, %o3
  70.     ld    [%o0+%o3], %o4
  71. rot_loop:
  72.     sll    %o4, 1, %o5
  73.     or    %o5, %o1, %o5
  74.     st    %o5, [%o0+%o3]
  75.     srl    %o4, 31, %o1
  76.     subcc    %o3, 4, %o3
  77.     bge,a    rot_loop
  78.     ld    [%o0+%o3], %o4
  79.     retl
  80.     mov    %o1, %o0
  81.  
  82.     .seg    "data"
  83.  
  84.